<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String skin = request.getParameter("skin");
if (skin == null || skin.length() == 0) {
	skin = "blue";
}

Cookie[] cookie = request.getCookies();
if(cookie!=null&&cookie.length!=0)
for (int i = 0; i < cookie.length; i++) {
	if ("skin".equals(cookie[i].getName())&&cookie[i].getValue()!=null) {
		skin = cookie[i].getValue();
	}
}
session.setAttribute("skin", skin);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="Shortcut Icon" href="<%=basePath%>style/jx.ico" type="image/x-icon" />
<title></title>
<jsp:include page="/admin/common/css/style_login.jsp"></jsp:include>
<script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/cookie.js"></script>
<script language="javascript">
$(document).ready(function() {
	
	//用户名密码输入框互动显示效果
	$('#account').focus(function() {
		$(this).removeClass('userBoxOver');
		$(this).addClass('userBoxMove');
	});
	$('#account').blur(function() {
		if ($(this).val()) {
			$(this).removeClass('userBoxMove');
			$(this).addClass('userBoxOver');
		} else {
			$(this).removeClass('userBoxMove');
			$(this).addClass('userBox');
		}
	});
	$('#password').focus(function() {
		$(this).removeClass('passworkBoxOver');
		$(this).addClass('passworkBoxMove');
	});
	$('#password').blur(function() {
		if ($(this).val()) {
			$(this).removeClass('passworkBoxMove');
			$(this).addClass('passworkBoxOver');
		} else {
			$(this).removeClass('passworkBoxMove');
			$(this).addClass('passworkBox');
		}
	});
	$('#password').focus();
	$('#account').focus();
});
	
function login(){
	if(isEmpty($('#account').val())){
		$('#message').text('请输入登录账号');
		return;
	}
	if(isEmpty($('#password').val())){
		$('#message').text('请输入登录密码');
		return;
	}
	if(isEmpty($('#verifycode').val())){
		$('#message').text('请输入验证码');
		return;
	}
	$('#form').submit();
}

function refreshCode(){
	var newImg = '<%=basePath%>public/verifyCodeImage?ct=' + (new Date()).getTime();
	$('#vci').attr('src', newImg);
}

//字符串为空判断
function isEmpty(str){
	if(str == null || str == undefined || str.length == 0){
		return true;
	}
	return false;
}
//捕捉回车事件
$(document).keydown(function(event) {
  if (event.keyCode == 13) {
    $('form').each(function() {
      login();
    });
  }
});
</script>
</head>
<body>
	<div class="loginTopColor"></div>
	<div class="loginBg">
		<form action="<%=basePath %>login.action" id="form" method="post">
		<div class="loginLogo">公共开发平台</div>
		<div class="loginContent">
	    <input type="text" class="userBox" id="account" name="user.uname" maxlength="50" value="admin"/>
      <input type="password" class="passworkBox" id="password" name="user.pword" maxlength="50" value="111111"/>
			<a href="javascript:void(0);" onclick="javascript:login(); return false;" class="loginBtn" title="点击登录系统"></a>
			<div class="otherInput">
				<label>验证码</label>
				<input type="text" id="verifycode" name="verifycode"/>
				<img id="vci" src="<%=basePath%>public/verifyCodeImage" height="21" width="57" onclick="refreshCode();" alt="看不清楚？点击图片，换一张"/>
				<%-- 
				<label>用户类型</label>
				<select name="user.utype">
					<option value="1">内部用户</option>
					<option value="2">外部用户</option>
				</select>
				
				<label>帐&nbsp;&nbsp;&nbsp;&nbsp;套</label>
				<select name="setOfBook">
					<option value="1">正式帐套</option>
					<option value="2">学习帐套</option>
				</select>
				--%>
			</div>
            <a href="javascript:void(0);" class="skin" onclick="changeSkin();" title="点击切换皮肤"></a>
		</div>
		<span id="message">${message}</span>
		</form>
	</div>
	<div class="copyright">版权所有(C)重庆金鑫公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;服务热线：400-000-3877</div>
</body>
</html>
